import { sytRequest } from "@/request";

// GET /admin/hosp/hospitalSet/{page}/{limit}
// 获取分页列表
// 搜索医院
export const getHospitalSet = (page: number, limit: number, params: any) => {
    return sytRequest.get(`/hosp/hospitalSet/${page}/${limit}`, {
        params
    })
}

// 锁定
export const getHospitalSetLockById = (id: number, status: number) => {
    return sytRequest.get(`/hosp/hospitalSet/lock/${id}/${status === 0 ? 1 : 0}`)
}

// 新增医院设置
export const postHospitalSetSave = (body: any) => {
    return sytRequest.post("/hosp/hospitalSet/save", body);
}

//修改医院设置
export const putHospitalSetUpdate = (body: any) => {
    return sytRequest.put(`/hosp/hospitalSet/update`, body)
}

//删除医院设置
export const deleteHospitalSetById = (id: number) => {
    return sytRequest.delete(`/hosp/hospitalSet/remove/${id}`)
}

// DELETE /admin/hosp/hospitalSet/batchRemove
// 根据id列表批量删除
export const deleteHospitalSetBatchRemove = (data: React.Key[]) => {
    return sytRequest.delete(`/hosp/hospitalSet/batchRemove`, {
        data
    })
}

//获取医院列表数据
// GET /admin/hosp/hospital/{page}/{limit}
// 获取分页列表
export const getHospitalList = (page: number, limit: number, params: any) => {
    return sytRequest.get(`/hosp/hospital/${page}/${limit}`, {
        params
    })
}

// GET /admin/hosp/hospital/updateStatus/{id}/{status}
// 更新上线状态
export const getHospitalUpdateStatus = (id: string, status: number) => {
    return sytRequest.get(`/hosp/hospital/updateStatus/${id}/${status}`)
}

// GET /admin/hosp/hospital/show/{id}
// 获取医院详情
export const getHospitalShowById = function (id: string) {
    return sytRequest.get(`/hosp/hospital/show/${id}`);
}

// GET /admin/hosp/department/{hoscode}
// 根据hoscode(医院编码）获取该医院下的科室列表
export const getDepartmentByHoscode = (hoscode: string) => {
    return sytRequest.get(`/hosp/department/${hoscode}`)
}

// GET /admin/hosp/schedule/getScheduleRule/{page}/{limit}/{hoscode}/{depcode}
// 获取排班规则数据
export const getScheduleRule = (page: number, limit: number, hoscode: string, depcode: string) => {
    return sytRequest.get(`/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}

// GET /admin/hosp/schedule/findScheduleList/{hoscode}/{depcode}/{workDate}
// 获取workDate排班日期的排班详细列表
export const findScheduleList = (hoscode:string,depcode:string,workDate:string)=>{
    return sytRequest.get(`/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}